<?php

namespace app\common\model\server;

use app\common\contract\Category;
use app\common\contract\Curd;
use app\common\contract\Power;

class GroupModel implements Curd, Category, Power
{
    public function __construct()
    {
        $this->logic = model('logic.group');
    }

    //获取列表方法
    public function getListPage($data)
    {
    }

    //保存添加
    public function saveAdd($data)
    {
        return  $this->logic->saveAdd($data);
    }

    //获取某一行信息
    public function getRow($data)
    {
        return  $this->logic->getRow($data);
    }

    //根据条件获取单行
    public function getLine($where)
    {
        return  $this->logic->getLine($data);
    }

    //保存编辑
    public function saveEdit($data)
    {
        return  $this->logic->saveEdit($data);
    }

    //保存删除
    public function saveDel($data)
    {
        return  $this->logic->saveDel($data);
    }

    //获取树状结构
    public function getTree($data)
    {
        if (isset($data['parent_id']) && $data['parent_id'] > 0) {
            $parentId = $data['parent_id'];
        } else {
            $parentId = 0;
        }

        return $this->logic->getChildrenAll($parentId, $data);
    }

    //获取权限
    public function getPower($data)
    {
        return  $this->logic->getPower($data);
    }

    //保存权限
    public function savePower($data)
    {
        return  $this->logic->savePower($data);
    }
}
